package com.ghost.librariandb;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;

public class MainWindow
{

	private JFrame frmLibrariandb;
	private JTabbedPane tabbedPane;
	private AddBookPanel addBookPanel;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args)
	{
		DataProvider.getConnection();
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					MainWindow window = new MainWindow();
					window.frmLibrariandb.setVisible(true);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
		DataProvider.closeConnection();
	}

	/**
	 * Create the application.
	 */
	public MainWindow()
	{
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	public void initialize()
	{
		frmLibrariandb = new JFrame();
		frmLibrariandb.setTitle("LibrarianDB");
		frmLibrariandb.setBounds(100, 100, 450, 300);
		frmLibrariandb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frmLibrariandb.getContentPane().add(tabbedPane, BorderLayout.CENTER);
		
		TakeBook takeBook = new TakeBook();
		tabbedPane.addTab("Take Book", null, takeBook, null);
		
		ReturnBook returnBook = new ReturnBook();
		tabbedPane.addTab("Return Book", null, returnBook, null);
		
		addBookPanel = new AddBookPanel();
		tabbedPane.addTab("Add Book", null, addBookPanel, null);
		
		AddMember addMember = new AddMember();
		tabbedPane.addTab("Add Member", null, addMember, null);
	}
}
